#include "main.h"

void NMI_IRQHandler(void)
{

}

void HardFault_IRQHandler(void)
{
    while (1)
    {
    }
}

void SVC_IRQHandler(void)
{

}

void PendSV_IRQHandler(void)
{

}

void SysTick_IRQHandler(void)
{
    static u8 t10ms_ct = 0;
	
    static bool flag = 0;
    if (++t10ms_ct >= 10)
    {
        t10ms_ct = 0;
        base_10ms_f = true;
		flag = !flag;		
        u8_dn(&panel_comm.send_dly);
	
        
    }
    uart_byte_tmr_dn(&panel_comm);
    uart_byte_tmr_dn(&motor_comm);    
    Euart_byte_tmr_dn(&speak_comm);
    Kuart_byte_tmr_dn(&kmos_comm);
}
void UART0_IRQHandler(void)
{
    if ((UART_GetITStatus(UART0, UART_IT_RB) != RESET) && (UART_GetFlagStatus(UART0, UART_FLAG_RB) != RESET))
    {
        if(gu8_version == 0)
        {
            Kuart_recv_byte_isr();
        }
        else
        {
            Euart_recv_byte_isr();
        }
    }

    if ((UART_GetFlagStatus(UART0, UART_FLAG_TC) != RESET))
    {
        UART_ClearITPendingBit(UART0, UART_FLAG_TC);
        if(gu8_version == 0)
        {
            Kuart_send_byte_isr();
        }
        else
        {
            Euart_send_byte_isr();
        }
    }    
}
void UART1_IRQHandler(void)
{
    if ((UART_GetITStatus(UART1, UART_IT_RB) != RESET) && (UART_GetFlagStatus(UART1, UART_FLAG_RB) != RESET))
    {
        uart_recv_byte_isr(&panel_comm);
    }

    if ((UART_GetFlagStatus(UART1, UART_FLAG_TC) != RESET))
    {
        UART_ClearITPendingBit(UART1, UART_FLAG_TC);
        uart_send_byte_isr(&panel_comm);
    }    
}
void EUART0_IRQHandler(void)
{
    
    if ((EUART_GetITStatus(EUART_IT_RB) != RESET) && (EUART_GetFlagStatus(EUART_FLAG_RB) != RESET))//接收
    {
        uart_recv_byte_isr2(&motor_comm);
        
    }
    if((EUART_GetFlagStatus(EUART_FLAG_TC) != RESET))//发送
    {
        EUART_ClearITPendingBit(EUART_CLR_TC);        
        uart_send_byte_isr2(&motor_comm);
    }
}
